package org.idontknow.logger;

import java.io.*;
import java.util.Date;
import java.text.SimpleDateFormat;

class FileTrace implements Trace {

	private PrintStream out = null;

	private SimpleDateFormat sdf;

	public FileTrace() {
		try {
			// System.out.println(Hello.props.getProperty("pwd") +
			// File.separator + "traces.log");
			FileOutputStream fos = new FileOutputStream(System.getProperties()
					.getProperty("user.dir")
					+ File.separator + "output" + File.separator + "traces.log");
			out = new PrintStream(fos);
			sdf = new SimpleDateFormat("HH:mm:ss,SSS");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void debug(String message) {
		out.println(sdf.format(new Date()) + " [Debug]: " + message);
	}

	public void info(String message) {
		out.println(sdf.format(new Date()) + " [Info] : " + message);
	}

	public void error(String message) {
		out.println(sdf.format(new Date()) + " [Error]: " + message);
	}

	public void info(int number) {
		out.println(sdf.format(new Date()) + " [Info] " + number);
	}
}
